<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>系统后台 - {$Think.config.INTENDANT_NAME} - by HemaCMS</title>
    <link href="__INTENDANT__/css/admin_style.css" rel="stylesheet" />
    <script src="__COMMON__/jquery.js"></script>
    <script src="__COMMON__/jquery.cookie.js"></script>
    <script src="__COMMON__/datePicker/datePicker.js"></script><!--时间插件-->
    <link href="__COMMON__/datePicker/style.css" rel="stylesheet" /> <!--时间插件CSS-->
    <link href="__COMMON__/zTree/css/zTreeStyle/zTreeStyle.css"  rel="stylesheet" />
    <script src="__COMMON__/zTree/js/jquery.ztree.core-3.5.min.js"></script>
    <script src="__COMMON__/zTree/js/jquery.ztree.excheck-3.5.min.js"></script>
    <script src="__COMMON__/layer/layer.js"></script>
    <script src="__INTENDANT__/js/iteny.intendant.js"></script>
    <style type="text/css">
    .btn_wrap .btn_wrap_pd {
    padding: 10px 20px 10px;
    background: #eaeaea ;
    border-top: 1px solid #d8d8d8;
  }
    </style>
</head>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <div class="nav">
    <ul class="cc">
      <li <if condition="$isshow eq 1">class="current"</if>><a href="{:U('Content/main',array('catid'=>$catid,'isshow'=>1))}">{$catname}({$artIsyesCount})</a></li>
      <li <if condition="$isshow eq 0">class="current"</if>><a href="{:U('Content/main',array('catid'=>$catid,'isshow'=>0))}">待审核文章({$artIsnoCount})</a></li>
    </ul>
  </div>
  <div class="mb10" style="margin-bottom: 10px;">


    <!-- <a href="/shuipfcms/index.php?a=lists&catid=10" target="_blank"  class="btn" title="访问该栏目">访问该栏目</a> -->
  </div>
  <div class="table_list">
	  <div class="h_a">搜索</div>
	  <form method="get" action="{:U('Content/main',array('catid'=>$catid,'isshow'=>$isshow))}">
	    <div class="search_type cc mb10">
	      <div class="mb10">
	        <span class="mr20">时间：
	        <input type="text" name="start_time" class="input length_2 J_date" value="<if condition='$start_time neq 0 '>{$start_time|date='Y-m-d',###}</if>" style="width:80px;">-<input type="text" class="input length_2 J_date" name="end_time" value="<if condition='$start_time neq 0'>{$end_time|date='Y-m-d',###}</if>" style="width:80px;">
	        <select class="select_2" name="searchtype" style="width:70px;">
	          <option value='title' >标题</option>
	          <option value='username' >用户名</option>
	          <option value='content' >文章内容</option>
	        </select>
	        关键字：
	        <input type="text" class="input length_2" name="keyword" style="width:200px;" value="" placeholder="请输入关键字...">
	        <button class="btn">搜索</button>
	        </span>
	      </div>
	    </div>
	  </form>
  </div>
  <form class="J_ajaxForm" action="" method="post">
    <div class="table_list">
      <table width="100%">
        <colgroup>
        <col width="16">
        <col width="50">
        <col width="60">
        <col width="">
        <col width="80">
        <col width="90">
        <col width="140">
        <col width="120">
        </colgroup>
        <thead>
          <tr>
            <td><label><input type="checkbox" class="check-all" data-direction="x" data-checklist="J_check_x"></label></td>
            <td>排序</td>
            <td align="center">ID</td>
            <td>标题</td>
            <td align="center">点击量</td>
            <td align="center">发布人</td>
            <td align="center"><span>发帖时间</span></td>
            <td align="center">管理操作</td>
          </tr>
        </thead>
        <volist name="articlelist" id="vo">
        <tr>
            <td><input type="checkbox" class="ids" name="ids[]" value="{$vo.id}"></td>
            <td><input name='sort[{$vo.id}]' class="input mr5"  type='text' size='3' value='{$vo.sort}'></td>
            <td align="center"><a href="" title="点击生成">{$vo.id}</a></td>
            <td><a href="" target="_blank"><span style="color:#{$vo.titlecolor};font-weight: {$titlew};">{$vo.title}</span></a>
                                                          </td>
            <td align="center">{$vo.visitors}</td>
            <td align="center">{$vo.username}</td>
            <td align="center">{$vo.createtime|date="Y-m-d H:i:s",###}</td>
            <td align="center">
            <a href="javascript:;;" onClick="javascript:openwinx('{:U("Content/editArticle",array('catid'=>$catid,'id'=>$vo['id']))}')">修改</a> | <a href="http://localhost/shuipfcms/index.php?m=Content&a=delete&catid=10&id=30" class="J_ajax_del" >删除</a> | <a href="http://localhost/shuipfcms/index.php?g=Comments&m=Comments&searchtype=2&keyword=c-10-30" target="_blank">评论</a>            </td>
          </tr>
          </volist>
        </table>
      <div class="p10"><div class="pages">{$page}</div> </div>

    </div>
    <div class="btn_wrap">
      <div class="btn_wrap_pd">
        <a href="javascript:void(0)" onClick="javascript:openwinx('{:U("Content/addArticle",array('catid'=>$catid))}')" class="btn btn_submit mr10 J_ajax_submit_btn" title="添加内容"></span>添加内容</a>
        <button class="btn J_ajax_submit_btn" type="submit" data="{:U('Content/sortArticle')}">排序</button>
        <button class="btn J_ajax_submit_btn" type="submit" data="{:U('Content/isArticle')}" datatitle="1">审核</button>
        <button class="btn J_ajax_submit_btn" type="submit" data="{:U('Content/isArticle')}" datatitle="0">取消审核</button>
        <button class="btn J_ajax_submit_btn" type="submit" data="{:U('Content/delArticle')}">删除</button>
        <button class="btn" type="button" onClick="pushs()">推送</button>

      </div>
    </div>
  </form>
</div>

<script>
//日期选择器
var dateInput = $("input.J_date")
if (dateInput.length) {
  dateInput.datePicker();
}
//日期+时间选择器
var dateTimeInput = $("input.J_datetime");
if (dateTimeInput.length) {
    dateTimeInput.datePicker({
        time: true
    });
}
//打开新窗口
function openwinx(url,name,w,h) {
    window.open(url);
}
// setCookie('refersh_time', 0);
// function refersh_window() {
//     var refersh_time = getCookie('refersh_time');
//     if (refersh_time == 1) {
//         window.location.reload();
//     }
// }
// setInterval(function(){
// 	refersh_window()
// }, 3000);
$(function () {
	//全选的实现
  $(".check-all").click(function(){
    $(".ids").prop("checked", this.checked);
  });
  $('button.J_ajax_submit_btn').on('click', function (e) {
    e.preventDefault();
    var btn = $(this);
    var isshow = $(this).attr('datatitle');
        form = btn.parents('form.J_ajaxForm');
        if(btn.attr("disabledSubmit")){
          btn.text('请勿重复提交...').prop('disabled', true).addClass('disabled');
          return false;
      }
    btn.attr("disabledSubmit",true);
      var param = form.serialize();
      $.ajax({
      url: btn.attr('data'),
      dataType:'json',
      type:'POST',
      data:$.param({isshow:isshow}) + '&' + param,
      beforeSend: function(){
        layer.load(1);
      },
      success: function(data){
        layer.close(layer.load(1));
        if(!data.status){
          ITENY.alert('提示信息',data.info,2,'3000');

        } else {
          ITENY.alert('提示信息',data.info,1,'3000');
          setTimeout(function(){
                    ITENY.reloadPage(window);
                },3000);

        }
      },
      error: function(data){
        layer.close(layer.load(1));
        ITENY.alert('提示信息',data.responseText,1,'3000');

      }
    });
  });
    // Wind.use('ajaxForm','artDialog','iframeTools', function () {
    //     //批量移动
    //     $('#J_Content_remove').click(function (e) {
    //         var str = 0;
    //         var id = tag = '';
    //         $("input[name='ids[]']").each(function () {
    //             if ($(this).attr('checked')) {
    //                 str = 1;
    //                 id += tag + $(this).val();
    //                 tag = '|';
    //             }
    //         });
    //         if (str == 0) {
				// art.dialog.through({
				// 	id:'error',
				// 	icon: 'error',
				// 	content: '您没有勾选信息，无法进行操作！',
				// 	cancelVal: '关闭',
				// 	cancel: true
				// });
    //             return false;
    //         }
    //         var $this = $(this);
    //         art.dialog.open("/shuipfcms/index.php?g=Content&m=Content&a=remove&catid=10&ids=" + id, {
    //             title: "批量移动"
    //         });
    //     });
    // });
});

function view_comment(obj) {
	Wind.use('artDialog','iframeTools', function () {
         art.dialog.open($(obj).attr("data-url"), {
			close:function(){
				$(obj).focus();
			},
            title: $(obj).attr("data-title"),
			width:"800px",
            height: '520px',
			id:"view_comment",
            lock: true,
            background:"#CCCCCC",
            opacity:0
        });
    });
}

function pushs() {
    var str = 0;
    var id = tag = '';
    $("input[name='ids[]']").each(function () {
        if ($(this).attr('checked')) {
            str = 1;
            id += tag + $(this).val();
            tag = '|';
        }
    });
    if (str == 0) {
       art.dialog({
		   id:'error',
		   icon: 'error',
		   content: '您没有勾选信息，无法进行操作！',
		   cancelVal: '关闭',
		   cancel: true
		});
        return false;
    }
    Wind.use('artDialog','iframeTools', function () {
         art.dialog.open("/shuipfcms/index.php?g=Content&m=Content&a=push&action=position_list&modelid=1&catid=10&id=" + id, {
            title: "信息推送"
        });
    });
}
</script>
</body>
</html>